package com.hz.zbl.controller;

import com.hz.zbl.model.dto.StudentDTO;
import com.hz.zbl.model.request.ApiResponse;
import com.hz.zbl.service.StudentService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/user")
public class StudentController {

    @Resource
    StudentService studentService;

    @PostMapping("/student-info")
    public String studentInfo(@RequestParam("student_id") int student_id){

        StudentDTO result = studentService.selectStudentById(student_id);

        return result == null ? ApiResponse.intError() : ApiResponse.ok(result);
    }

}
